home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / HyperCuber 2.0 Source / CKeyControlsArrayPane.cp < prev    next >
Encoding:
Text File  |  1994-04-06  |  2.4 KB  |  84 lines  |  [TEXT/KAHL]

  1. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. //| CKeyControlsArrayPane.cp
  3. //|
  4. //| This implements the scrolling list in the key controls
  5. //| window.
  6. //|_________________________________________________________
  7.  
  8.  
  9. #include "CKeyControlsArrayPane.h"
  10. #include "Keys.h"
  11.  
  12. #include <stdio.h>
  13. #include <string.h>
  14.  
  15.  
  16. //======================== Prototypes ======================\\
  17.  
  18. extern void DrawKey(short key_code, short modifiers, short h, short v);
  19.  
  20.  
  21.  
  22. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  23. //| CKeyControlsArrayPane::IKeyControlsArrayPane
  24. //|
  25. //| Purpose: Initialize the key controls array pane.
  26. //|
  27. //| Parameters: passed to superclass
  28. //|______________________________________________________________________________
  29.  
  30. void CKeyControlsArrayPane::IKeyControlsArrayPane(CView *anEnclosure,
  31.                             CBureaucrat *aSupervisor,
  32.                             short aWidth, short aHeight,
  33.                             short aHEncl, short aVEncl,
  34.                             SizingOption aHSizing, SizingOption aVSizing)
  35. {
  36.  
  37.     CArrayPane::IArrayPane(anEnclosure, aSupervisor, aWidth,
  38.                             aHeight, aHEncl, aVEncl, aHSizing, aVSizing);
  39.  
  40. }    //==== CKeyControlsArrayPane::IKeyControlsArrayPane() ====\\
  41.  
  42.  
  43.  
  44. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. //| CKeyControlsArrayPane::DrawCell
  46. //|
  47. //| Purpose: Initialize the about dialog.
  48. //|
  49. //| Parameters: cell: the cell to draw
  50. //|             rect: rectangle of the cell
  51. //|______________________________________________________________________________
  52.  
  53. void CKeyControlsArrayPane::DrawCell(Cell cell, Rect *rect)
  54. {
  55.  
  56.     key_control_struct key;
  57.     itsArray->GetItem(&key, cell.v+1);            //  Get the key control
  58.  
  59.     char table_string[100];
  60.  
  61.     char angle_string[5];
  62.     if (key.angle == 0)
  63.         strcpy(angle_string, "P");
  64.     else
  65.         sprintf(angle_string, "%d", key.angle);
  66.  
  67.     sprintf(table_string, "%s [%d:%s] by %d",    //  Build the description string
  68.             (key.increment >= 0) ?
  69.                         "Increase" : "Decrease",
  70.             key.dimension, angle_string,
  71.             (key.increment >= 0) ?
  72.                 key.increment : -key.increment);
  73.     
  74.     TextFont(systemFont);                        //  Set font to Chicago
  75.     MoveTo(rect->left+3, rect->bottom-5);
  76.     DrawString(CtoPstr(table_string));            //  Display the description string
  77.  
  78.     DrawKey(key.key_code, key.modifiers,
  79.                 220, rect->bottom-5);            //  Draw the key
  80.  
  81.     TextFont(applFont);                            //  Switch back to application font
  82.  
  83. }    //==== CKeyControlsArrayPane::DrawCell() ====\\
  84.